package fr.gedos.ged.classifier.core.entities.dao;

import org.hibernate.HibernateException;

import java.io.Serializable;

/**
 * Interface Generic DAO.
 * @author Marshall
 *
 * @param <T>
 */
public interface GenericDAO<T> extends Serializable {

    /**
     * Generic method load.
     * 
     * @param id
     *            id
     * @return objet
     * @throws HibernateException
     *             Exception
     */
    T load(Long id);

    /**
     * Generic method get.
     * 
     * @param id
     *            id
     * @return objet
     */
    T get(Long id);

    /**
     * Generic method save or update.
     * 
     * @param entity
     *            object to save
     * @return T objet
     */
    T saveOrUpdate(T entity);

    /**
     * Generic method save.
     * 
     * @param entity
     *            object to save
     * @return T objet
     */
    T save(T entity);

    /**
     * Generic method refresh.
     * 
     * @param entity
     *            object to refresh
     */
    void refresh(T entity);

    /**
     * Generic method delete.
     * 
     * @param entity
     *            object to delete
     */
    void delete(T entity);

}
